﻿using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //日期
            DateTime dt = DateTime.Now;
            Console.WriteLine(dt.ToString("当前时间为："+dt ));
            Console.WriteLine("当前为本月的第几天："+dt.Day);
            Console.WriteLine("当前是："+ dt.DayOfWeek);
            Console.WriteLine("当前是本年度第几天："+ dt.DayOfYear);
            Console.WriteLine("30 天后的日期是："+ dt.AddDays(30));




            DateTime dt1= DateTime.Now;
            DateTime dt2 = new DateTime(2020, 6, 28);
            TimeSpan ts = dt2 - dt1;
            Console.WriteLine("间隔的天数为天" + ts.Days );

            //字符串
            var strl = "好好学习天天向上床前明月光";
            Console.WriteLine(strl.Length);

            for(int i=strl .Length - 1; i >= 0; i--)
            {
                Console.WriteLine(strl[i]);
            }

            var indexStr = strl.IndexOf("学");
            Console.WriteLine(indexStr);

            Console.WriteLine(strl.LastIndexOf("床"));
            Console.WriteLine(strl.LastIndexOf("光"));

            var str2 = strl.Replace("光","光光");
            Console.WriteLine(str2);
            var str3 = strl.Substring(5);
            Console.WriteLine(str3);
            var str4 = strl.Substring(3,2);
            Console.WriteLine(str4);







        }
    }
}
